<!doctype html>
<html class="no-js" lang="">
    <head>
        <meta charset="utf-8">
        <meta http-equiv="x-ua-compatible" content="ie=edge">
        <title>eh documentation</title>
        <meta name="description" content="">
        <meta name="viewport" content="width=device-width, initial-scale=1">

        <link rel="icon" type="image/x-icon" href="../images/favicon.ico">
	      <link rel="stylesheet" href="../styles/style.css">
    </head>
    <body>

        <div class="navbar navbar-default navbar-fixed-top visible-xs">
            <a href="../" class="navbar-brand">eh documentation</a>
            <button type="button" class="btn btn-default btn-menu ion-ios-menu" id="btn-menu"></button>
        </div>

        <div class="xs-menu menu" id="mobile-menu">
                <div id="book-search-input" role="search">
    <input type="text" placeholder="Type to search">
</div>
            <compodoc-menu></compodoc-menu>
        </div>

        <div class="container-fluid main">
           <div class="row main">
               <div class="hidden-xs menu">
                   <compodoc-menu mode="normal"></compodoc-menu>
               </div>
               <!-- START CONTENT -->
               <div class="content injectable">
                   <div class="content-data">







<ol class="breadcrumb">
  <li>Injectables</li>
  <li>StoreService</li>
</ol>

<ul class="nav nav-tabs" role="tablist">
        <li class="active">
            <a href="#info" role="tab" id="info-tab" data-toggle="tab" data-link="info">Info</a>
        </li>
        <li >
            <a href="#source" role="tab" id="source-tab" data-toggle="tab" data-link="source">Source</a>
        </li>
</ul>

<div class="tab-content">
    <div class="tab-pane fade active in" id="c-info">
        <p class="comment">
            <h3>File</h3>
        </p>
        <p class="comment">
            <code>src/app/api/store.service.ts</code>
        </p>



            <section>
    <h3 id="index">Index</h3>
    <table class="table table-sm table-bordered index-table">
        <tbody>
                <tr>
                    <td class="col-md-4">
                        <h6><b>Properties</b></h6>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <ul class="index-list">
                            <li>
                                <a href="#state">state</a>
                            </li>
                            <li>
                                <a href="#sub">sub</a>
                            </li>
                        </ul>
                    </td>
                </tr>

                <tr>
                    <td class="col-md-4">
                        <h6><b>Methods</b></h6>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <ul class="index-list">
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#addGood">addGood</a>
                            </li>
                            <li>
                                <a href="#addListen">addListen</a>
                            </li>
                            <li>
                                <a href="#afterFn">afterFn</a>
                            </li>
                            <li>
                                <a href="#commit">commit</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#delGoodImgs">delGoodImgs</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#dispatch">dispatch</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#doEnroll">doEnroll</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#doLogin">doLogin</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#findGood">findGood</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#findUser">findUser</a>
                            </li>
                            <li>
                                <a href="#init">init</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#logout">logout</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#saveGood">saveGood</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#saveUser">saveUser</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#selectConfig">selectConfig</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#sendEmailCode">sendEmailCode</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#sendPhoneCode">sendPhoneCode</a>
                            </li>
                            <li>
                                <a href="#subscribe">subscribe</a>
                            </li>
                            <li>
                                    <span class="modifier">Async</span>
                                <a href="#test">test</a>
                            </li>
                        </ul>
                    </td>
                </tr>





        </tbody>
    </table>
</section>

            <section>
    <h3 id="constructor">Constructor</h3>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
<code>constructor(userService: , emailCodeService: , phoneCodeService: , configService: , goodService: , activatedRoute: <a href="https://angular.io/api/router/ActivatedRoute" target="_blank">ActivatedRoute</a>, router: <a href="https://angular.io/api/router/Router" target="_blank">Router</a>)</code>
                    </td>
                </tr>
                        <tr>
                            <td class="col-md-4">
                                <div class="io-line">Defined in <a href="" data-line="83" class="link-to-prism">src/app/api/store.service.ts:83</a></div>
                            </td>
                        </tr>

                <tr>
                    <td class="col-md-4">
                            <div>
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                    <td>Type</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>userService</td>
                                                  
                                                        <td>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                                <tr>
                                                        <td>emailCodeService</td>
                                                  
                                                        <td>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                                <tr>
                                                        <td>phoneCodeService</td>
                                                  
                                                        <td>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                                <tr>
                                                        <td>configService</td>
                                                  
                                                        <td>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                                <tr>
                                                        <td>goodService</td>
                                                  
                                                        <td>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                                <tr>
                                                        <td>activatedRoute</td>
                                                  
                                                        <td>
                                                                    <code><a href="https://angular.io/api/router/ActivatedRoute" target="_blank" >ActivatedRoute</a></code>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                                <tr>
                                                        <td>router</td>
                                                  
                                                        <td>
                                                                    <code><a href="https://angular.io/api/router/Router" target="_blank" >Router</a></code>
                                                        </td>
                                                  
                                                    <td>
                                                            No
                                                    </td>
                                                    
                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                    </td>
                </tr>
            </tbody>
        </table>
</section>

            <section>
    
        <h3 id="methods">
            Methods
        </h3>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="addGood"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            addGood
                            </b>
                            <a href="#addGood"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>addGood(state: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="244" class="link-to-prism">src/app/api/store.service.ts:244</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="addListen"></a>
                        <span class="name">
                            <b>
                            addListen
                            </b>
                            <a href="#addListen"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
<code>addListen()</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="124" class="link-to-prism">src/app/api/store.service.ts:124</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                <b>Returns : </b>    <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>

                            </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="afterFn"></a>
                        <span class="name">
                            <b>
                            afterFn
                            </b>
                            <a href="#afterFn"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
<code>afterFn(fn: , afterFn: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="148" class="link-to-prism">src/app/api/store.service.ts:148</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>fn</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>afterFn</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>() &#x3D;&gt; any</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="commit"></a>
                        <span class="name">
                            <b>
                            commit
                            </b>
                            <a href="#commit"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
<code>commit(state: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="106" class="link-to-prism">src/app/api/store.service.ts:106</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="delGoodImgs"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            delGoodImgs
                            </b>
                            <a href="#delGoodImgs"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>delGoodImgs(state: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="296" class="link-to-prism">src/app/api/store.service.ts:296</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="dispatch"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            dispatch
                            </b>
                            <a href="#dispatch"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>dispatch(type: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="112" class="link-to-prism">src/app/api/store.service.ts:112</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>type</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="doEnroll"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            doEnroll
                            </b>
                            <a href="#doEnroll"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>doEnroll(state: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="183" class="link-to-prism">src/app/api/store.service.ts:183</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="doLogin"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            doLogin
                            </b>
                            <a href="#doLogin"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>doLogin(state: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="159" class="link-to-prism">src/app/api/store.service.ts:159</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="findGood"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            findGood
                            </b>
                            <a href="#findGood"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>findGood(state: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="280" class="link-to-prism">src/app/api/store.service.ts:280</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="findUser"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            findUser
                            </b>
                            <a href="#findUser"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>findUser(state: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="201" class="link-to-prism">src/app/api/store.service.ts:201</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="init"></a>
                        <span class="name">
                            <b>
                            init
                            </b>
                            <a href="#init"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
<code>init()</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="97" class="link-to-prism">src/app/api/store.service.ts:97</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                <b>Returns : </b>    <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >void</a></code>

                            </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="logout"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            logout
                            </b>
                            <a href="#logout"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>logout(state: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="155" class="link-to-prism">src/app/api/store.service.ts:155</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="saveGood"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            saveGood
                            </b>
                            <a href="#saveGood"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>saveGood(state: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="260" class="link-to-prism">src/app/api/store.service.ts:260</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="saveUser"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            saveUser
                            </b>
                            <a href="#saveUser"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>saveUser(state: , params: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="228" class="link-to-prism">src/app/api/store.service.ts:228</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                        <td>params</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="selectConfig"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            selectConfig
                            </b>
                            <a href="#selectConfig"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>selectConfig(state: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="316" class="link-to-prism">src/app/api/store.service.ts:316</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="sendEmailCode"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            sendEmailCode
                            </b>
                            <a href="#sendEmailCode"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>sendEmailCode(state: , undefined: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="214" class="link-to-prism">src/app/api/store.service.ts:214</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="sendPhoneCode"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            sendPhoneCode
                            </b>
                            <a href="#sendPhoneCode"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>sendPhoneCode(state: , undefined: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="221" class="link-to-prism">src/app/api/store.service.ts:221</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>state</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                                <tr>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code>{}</code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="subscribe"></a>
                        <span class="name">
                            <b>
                            subscribe
                            </b>
                            <a href="#subscribe"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
<code>subscribe(callback: )</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="120" class="link-to-prism">src/app/api/store.service.ts:120</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                    <b>Parameters :</b>
                                    <table class="params">
                                        <thead>
                                            <tr>
                                                <td>Name</td>
                                                <td>Optional</td>
                                            </tr>
                                        </thead>
                                        <tbody>
                                                <tr>
                                                        <td>callback</td>
                                                    
                                                    <td>
                                                            No
                                                    </td>
                                                    

                                                </tr>
                                        </tbody>
                                    </table>
                            </div>
                            <div>
                            </div>
                            <div class="io-description">
                                <b>Returns : </b>    <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>

                            </div>
                                <div class="io-description">
                                    
                                </div>
                    </td>
                </tr>
            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="test"></a>
                        <span class="name">
                            <b>
                                <span class="modifier">Async</span>
                            test
                            </b>
                            <a href="#test"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                            <span class="modifier-icon icon ion-ios-reset"></span>
                        <code>test()</code>
                    </td>
                </tr>


                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="116" class="link-to-prism">src/app/api/store.service.ts:116</a></div>
                            </td>
                        </tr>


                <tr>
                    <td class="col-md-4">

                            <div class="io-description">
                                <b>Returns : </b>    <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>

                            </div>
                    </td>
                </tr>
            </tbody>
        </table>
</section>

            <section>
    
        <h3 id="inputs">
            Properties
        </h3>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="state"></a>
                        <span class="name">
                            <b>
                            state
                            </b>
                            <a href="#state"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>state:     <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Type : </i>    <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>

                        </td>
                    </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Default value : </i><code>{
    query: {},
    user: {
      login: {
        username: String,
        password: String,
        remember: Boolean,
        verify: String,
      },
      info: {
        email: &#x27;&#x27;,
        phone: &#x27;&#x27;,
        nickname: &#x27;&#x27;,
        name: &#x27;&#x27;,
        gender: &#x27;&#x27;,
        birthday: &#x27;&#x27;,
        address: &#x27;&#x27;,
        job: &#x27;&#x27;,
        edu: &#x27;&#x27;,
        salary: &#x27;&#x27;,
        sign: &#x27;&#x27;,
      },
    },
    good: {
      save: {},
    },
    common: {
      config: {},
    },
  }</code>
                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="52" class="link-to-prism">src/app/api/store.service.ts:52</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
        <table class="table table-sm table-bordered">
            <tbody>
                <tr>
                    <td class="col-md-4">
                        <a name="sub"></a>
                        <span class="name">
                            <b>
                            sub
                            </b>
                            <a href="#sub"><span class="icon ion-ios-link"></span></a>
                        </span>
                    </td>
                </tr>
                <tr>
                    <td class="col-md-4">
                        <code>sub:     <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>
</code>
                    </td>
                </tr>
                    <tr>
                        <td class="col-md-4">
                            <i>Type : </i>    <code><a href="https://www.typescriptlang.org/docs/handbook/basic-types.html" target="_blank" >any</a></code>

                        </td>
                    </tr>
                        <tr>
                            <td class="col-md-4">
                                    <div class="io-line">Defined in <a href="" data-line="83" class="link-to-prism">src/app/api/store.service.ts:83</a></div>
                            </td>
                        </tr>


            </tbody>
        </table>
</section>

    </div>


    <div class="tab-pane fade  tab-source-code" id="c-source">
        <pre class="line-numbers compodoc-sourcecode"><code class="language-typescript">import { Injectable, Inject, OnInit } from &#x27;@angular/core&#x27;;
import { Observable, Subject, ReplaySubject, from, of, range, BehaviorSubject } from &#x27;rxjs&#x27;;
import { HttpClientModule, HTTP_INTERCEPTORS } from &#x27;@angular/common/http&#x27;;
import { Router, NavigationEnd } from &#x27;@angular/router&#x27;;
import { ActivatedRoute } from &#x27;@angular/router&#x27;;

import _ from &#x27;lodash&#x27;;

declare var localStorage;

const computed &#x3D; fn &#x3D;&gt; {
  return fn();
};

const localStore &#x3D; {
  name: &#x27;ehStore&#x27;,
  set(v) {
    localStorage.ehStore &#x3D; v;
  },
  get() {
    const store &#x3D; JSON.parse(localStorage[this.name]);
    if (!this.has()) {
      return {};
    }
    return store;
  },
  del() {
    localStorage.removeItem(this.name);
  },
  has() {
    const store &#x3D; JSON.parse(localStorage[this.name] || &#x27;{}&#x27;);
    if (store &#x3D;&#x3D;&#x3D; &#x27;undefined&#x27;) {
      return false;
    }
    if (JSON.stringify(store) &#x3D;&#x3D;&#x3D; &#x27;{}&#x27;) {
      return false;
    }
    if (!store) {
      return false;
    }
    return true;
  },
  isEmpty() {
    return !(this.has() &amp;&amp; JSON.stringify(this.get()) !&#x3D;&#x3D; &#x27;{}&#x27;);
  },
};

@Injectable({
  providedIn: &#x27;root&#x27;,
})
export class StoreService {
  state: any &#x3D; {
    query: {},
    user: {
      login: {
        username: String,
        password: String,
        remember: Boolean,
        verify: String,
      },
      info: {
        email: &#x27;&#x27;,
        phone: &#x27;&#x27;,
        nickname: &#x27;&#x27;,
        name: &#x27;&#x27;,
        gender: &#x27;&#x27;,
        birthday: &#x27;&#x27;,
        address: &#x27;&#x27;,
        job: &#x27;&#x27;,
        edu: &#x27;&#x27;,
        salary: &#x27;&#x27;,
        sign: &#x27;&#x27;,
      },
    },
    good: {
      save: {},
    },
    common: {
      config: {},
    },
  };

  sub: any;

  constructor(
    @Inject(&#x27;UserService&#x27;) private userService,
    @Inject(&#x27;EmailCodeService&#x27;) private emailCodeService,
    @Inject(&#x27;PhoneCodeService&#x27;) private phoneCodeService,
    @Inject(&#x27;ConfigService&#x27;) private configService,
    @Inject(&#x27;GoodService&#x27;) private goodService,
    private activatedRoute: ActivatedRoute,
    private router: Router,
  ) {
    this.init();
  }

  init() {
    this.sub &#x3D; new ReplaySubject();
    // if (!localStore.isEmpty()) {
    //   // logout 要清楚本地持久数据
    //   this.commit(localStore.get());
    // }
    this.addListen();
  }

  commit(state) {
    _.merge(this.state, state);
    localStore.set(JSON.stringify(this.state));
    this.sub.next(this.state);
  }

  async dispatch(type, params) {
    return await this[type](this.state, params);
  }

  async test() {
    const res &#x3D; await this.userService.select().toPromise();
  }

  subscribe(callback) {
    return this.sub.subscribe(callback);
  }

  addListen() {
    this.subscribe(state &#x3D;&gt; {});
    this.router.events.subscribe(
      (val: any) &#x3D;&gt; {
        if (val instanceof NavigationEnd) {
          if (val.url &#x3D;&#x3D;&#x3D; &#x27;/u/login&#x27;) {
          }
        }
      },
      () &#x3D;&gt; {},
      () &#x3D;&gt; {},
    );

    this.activatedRoute.queryParams.subscribe(async params &#x3D;&gt; {
      await this.commit(
        _.merge(this.state, {
          query: {
            ...params,
          },
        }),
      );
    });
  }

  afterFn(fn, afterFn) {
    return function() {
      const ret &#x3D; fn.apply(this, arguments);
      afterFn.apply(this, arguments);
      return ret;
    };
  }
  async logout(state, params) {
    localStore.del();
  }
  // action
  async doLogin(state, params) {
    const res &#x3D; await this.userService
      .find({
        username: params.username,
        type: params.type,
        password: params.password,
        verify: params.verify,
      })
      .toPromise();
    await this.commit(
      _.merge(state, {
        user: {
          login: {
            ...params,
          },
          info: res.data,
        },
      }),
    );
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }

  async doEnroll(state, params) {
    const res &#x3D; await this.userService
      .add({
        ...params,
      })
      .toPromise();
    await this.commit(
      _.merge(state, {
        user: {
          login: { ...params },
        },
      }),
    );
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }

  async findUser(state, params) {
    console.log(88888888, params);
    const res &#x3D; await this.userService.find(params).toPromise();
    await this.commit(
      _.merge(state, {
        user: {
          info: res.data,
        },
      }),
    );
    return res;
  }

  async sendEmailCode(state, { email }) {
    const res &#x3D; await this.emailCodeService.add({ email, type: this.state.common.config.isEmail }).toPromise();
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }

  async sendPhoneCode(state, { phone }) {
    const res &#x3D; await this.phoneCodeService.add({ phone, type: this.state.common.config.isPhone }).toPromise();
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }

  async saveUser(state, params) {
    const res &#x3D; await this.userService.save(params.id || state.user.info._id, { ...params }).toPromise();
    if (&#x27;200&#x27; &#x3D;&#x3D;&#x3D; res.code) {
      await this.commit(
        _.merge(state, {
          user: {
            info: res.data,
          },
        }),
      );
    }
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }

  async addGood(state, params) {
    const res &#x3D; await this.goodService.add({ ...params }).toPromise();
    if (&#x27;200&#x27; &#x3D;&#x3D;&#x3D; res.code) {
      await this.commit(
        _.merge(state, {
          good: {
            save: res.data,
          },
        }),
      );
    }
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }

  async saveGood(state, params) {
    const p &#x3D; {
      ...params,
    };
    delete p.id;
    const res &#x3D; await this.goodService.save(params.id, { ...p }).toPromise();
    if (&#x27;200&#x27; &#x3D;&#x3D;&#x3D; res.code) {
      await this.commit(
        _.merge(state, {
          good: {
            save: res.data,
          },
        }),
      );
    }
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }

  async findGood(state, params) {
    const res &#x3D; await this.goodService.find(params.id).toPromise();
    if (&#x27;200&#x27; &#x3D;&#x3D;&#x3D; res.code) {
      await this.commit(
        _.merge(state, {
          good: {
            save: res.data,
          },
        }),
      );
    }
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }

  async delGoodImgs(state, params) {
    const data &#x3D; {
      ...params,
    };
    delete data.id;
    const res &#x3D; await this.goodService.del(params.id, data).toPromise();
    if (&#x27;200&#x27; &#x3D;&#x3D;&#x3D; res.code) {
      // await this.commit(
      //   _.merge(state, {
      //     good: {
      //       save: res.data,
      //     },
      //   }),
      // );
    }
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }

  async selectConfig(state) {
    const res &#x3D; await this.configService.select().toPromise();
    await this.commit(
      _.merge(state, {
        common: {
          config: res.data,
        },
      }),
    );
    return new Promise(resolve &#x3D;&gt; {
      resolve(res);
    });
  }
}
</code></pre>
    </div>

</div>











                   </div><div class="search-results">
    <div class="has-results">
        <h1 class="search-results-title"><span class='search-results-count'></span> result-matching "<span class='search-query'></span>"</h1>
        <ul class="search-results-list"></ul>
    </div>
    <div class="no-results">
        <h1 class="search-results-title">No results matching "<span class='search-query'></span>"</h1>
    </div>
</div>
</div>
               <!-- END CONTENT -->
           </div>
       </div>

       <script>
            var COMPODOC_CURRENT_PAGE_DEPTH = 1;
            var COMPODOC_CURRENT_PAGE_CONTEXT = 'injectable';
            var COMPODOC_CURRENT_PAGE_URL = 'StoreService.html';
       </script>

       <script src="../js/libs/custom-elements.min.js"></script>
       <script src="../js/libs/lit-html.js"></script>
       <script src="../js/menu-wc.js"></script>

       <script src="../js/libs/bootstrap-native.js"></script>

       <script src="../js/libs/es6-shim.min.js"></script>
       <script src="../js/libs/EventDispatcher.js"></script>
       <script src="../js/libs/promise.min.js"></script>
       <script src="../js/libs/zepto.min.js"></script>

       <script src="../js/compodoc.js"></script>

       <script src="../js/tabs.js"></script>
       <script src="../js/menu.js"></script>
       <script src="../js/libs/clipboard.min.js"></script>
       <script src="../js/libs/prism.js"></script>
       <script src="../js/sourceCode.js"></script>
          <script src="../js/search/search.js"></script>
          <script src="../js/search/lunr.min.js"></script>
          <script src="../js/search/search-lunr.js"></script>
          <script src="../js/search/search_index.js"></script>
       <script src="../js/lazy-load-graphs.js"></script>


    </body>
</html>
